//2009/08/11 15:38:11
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;

class GardenHose
{
public:
    int countDead(int n, int rowDist, int colDist, int hoseDist)
    {
		int deadPlants = 0;
        for (int row=0; row<n; row++)
        {
            for (int col=0; col<n; col++)
            {
                // Try watering from ends of row.
                if ((row+1)*rowDist <= hoseDist) continue;
                if ((n-row)*rowDist <= hoseDist) continue;

                //Try watering from ends of column.
                if ((col+1)*colDist <= hoseDist) continue;
                if ((n-col)*colDist <= hoseDist) continue;
                deadPlants++;
            }
        }
		return deadPlants;
		//return max(n-2*(hose/row), 0) * max(n-2*(hose/col), 0);
    }
};

